home *** CD-ROM | disk | FTP | other *** search
/ PC Media 7 / PC MEDIA CD07.iso / share / prog / cm / cmtokens.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-06  |  1.5 KB  |  38 lines

  1. // CmTokens.h
  2. // -----------------------------------------------------------------
  3. // Compendium - C++ Container Class Library
  4. // Copyright (C) 1992-1994, Glenn M. Poorman, All rights reserved
  5. // -----------------------------------------------------------------
  6. // String tokenizer definition.
  7. // -----------------------------------------------------------------
  8.  
  9. #ifndef _CMTOKENS_H
  10. #define _CMTOKENS_H
  11.  
  12. #include <cm/include/cmstring.h>
  13.  
  14. class CmTokens : public CmObject {          // Tokenizer class definition.
  15. public:
  16.   CmTokens(const char*);                    // Tokenizer constructor.
  17.   CmTokens(const CmTokens&);                // Tokenizer copy constructor.
  18.  
  19.   CmTokens& operator=(const CmTokens&);     // Assignment operator.
  20.  
  21.   const char* next (const char* = "\n");    // Get next token.
  22.   void        reset();                      // Reset to start of string.
  23.  
  24.   Bool     isEqual (CmObject*) const;       // Compare tokenizer strings.
  25.   int      compare (CmObject*) const;       // Compare tokenizer strings.
  26.   unsigned hash    (unsigned)  const;       // Hash tokenizer string.
  27.   void     printOn (ostream&)  const;       // Print tokenizer string.
  28.  
  29.   CMOBJECT_DEFINE(CmTokens, CmObject)       // Define object funcs.
  30.  
  31. private:
  32.   CmString    _string;                      // String to tokenize.
  33.   const char *_place;                       // Place holder.
  34.   int         _idx;                         // Place holder index.
  35. };
  36.  
  37. #endif
  38.